package cn.edu.jnu.supershopper;

import androidx.appcompat.app.AppCompatActivity;

import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

import com.google.zxing.util.QrCodeGenerator;

import java.util.ArrayList;

public class Share_Code extends AppCompatActivity {
    ImageView imgQrcode; // 二维码图片
    Button button;
    String ISBN;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_share_code);
        Intent intent =getIntent();
        ISBN = intent.getStringExtra("ISBN");
        imgQrcode = findViewById(R.id.share_img_qrcode);
        button = findViewById(R.id.share_button_OK);
        Bitmap bitmap = QrCodeGenerator.getQrCodeImage(ISBN,imgQrcode.getWidth(), imgQrcode.getHeight());
        imgQrcode.setImageBitmap(bitmap);

        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Share_Code.this.finish();
            }
        });
    }
}